import csv
import sys, os
import pandas as pd

class SPNAnnotation:
	def __init__(self, csv_row):
		self.__seriesUID = csv_row["seriesuid"]
		x = csv_row["coordX"]
		y = csv_row["coordY"]
		z = csv_row["coordZ"]
		self.__coord = (x, y, z)
		self.__diameter = csv_row["diameter_mm"]

	@property
	def seriesUID(self):
		return self.__seriesUID

	@property
	def coord(self):
		return self.__coord

	@property
	def diameter(self):
		return self.__diameter


class SPNAnnotationList:
	def __init__(self, csv_path):
		self.path = csv_path
		csv = pd.read_csv(csv_path)
		self.annotations = [SPNAnnotation(row[1]) for row in csv.iterrows()]

	def get_annotations_by_uid(self, file_name):
		return [anno for anno in self.annotations if anno.seriesUID == file_name]
